﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using University.Workshop.Model;
using University.Workshop.DataAccess;

namespace University.Workshop.Business
{
    public static class ViewTopicsManager
    {
        public static Collection<Topic> TopicsByCategory(String category)
        { 
            if(String.IsNullOrEmpty(category))
            {
                throw new ValidationException("Category is required");
            }
            Collection<Topic> topics = TopicDataAccess.SelectTopics(category);
            if (topics==null ||  topics.Count == 0  )
            {
                throw new ValidationException("0 topics");
            }
            return topics;
        }
    }
}
